from datetime import datetime

from typing import Optional

from ..base import BaseSchema, BaseApiOut


class ProfileBase(BaseSchema):
    username: Optional[str] = None
    email: Optional[str] = None
    name: Optional[str] = None
    is_active: Optional[int] = 0
    is_super: Optional[int] = 0
    role_id: Optional[int] = 0
    admin_id: Optional[int] = 0


class UpdatePassword(BaseSchema):
    confirm_password: Optional[str] = None
    new_password: Optional[str] = None
    old_password: Optional[str] = None


class Profile(ProfileBase):
    id: int

    role: Optional[list | str] = None

    created_at: Optional[datetime] = None
    updated_at: Optional[datetime] = None


class ProfileOut(BaseApiOut):
    data: Profile | None
